package com.yingsheng.bi.hks.template.events;

import java.util.Map;

public class ElementEvent extends SimpleEvent {

    private Event event;

    private String name;

    private String[] attrs;

    private Object input;

    private Object output;

    public ElementEvent(String name, Event event) {
        this.name = name;
        this.event = event;
    }

    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    public Object getInput() {
        return input;
    }

    public void setInput(Object input) {
        this.input = input;
    }

    public Object getOutput() {
        return output;
    }

    public void setOutput(Object output) {
        this.output = output;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String[] getAttrs() {
        return attrs;
    }

    public void setAttrs(String[] attrs) {
        this.attrs = attrs;
    }

    @Override
    public Map<String, Object> getDataMap() {
        if (event != null) {
            return event.getDataMap();
        } else {
            return super.getDataMap();
        }
    }

    @Override
    public void setDataMap(Map<String, Object> dataMap) {
        if (event != null) {
            event.setDataMap(dataMap);
        } else {
            super.setDataMap(dataMap);
        }
    }

    @Override
    public void reset() {
        this.input = null;
        this.output = null;
    }

}
